﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Wicresoft.JDPostBoard.Entity;

public partial class Gift_UnitEdit : BaseAuthenticationPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        if (this.tbUnitName.Text.Trim() == "")
        {
            WebCommon.ShowMessage(this, "请先输入单位名称");
            this.tbUnitName.Focus();
            return;
        }
        GiftUnit gu = new GiftUnit();
        if (gu.Load("UnitName='" + this.tbUnitName.Text.Trim() + "'"))
        {
            WebCommon.ShowMessage(this, "此单位名称已存在，请重新输入");
            this.tbUnitName.Focus();
            return;
        }
        gu.UnitName = this.tbUnitName.Text.Trim();
        gu.IsEnable = true;
        gu.ID = Guid.NewGuid();
        gu.CreateTime = DateTime.Now;
        gu.CreatorDsName = CurrentUser.DisplayName;
        gu.CreatorID = CurrentUser.ID.ToString();
        gu.CreatorName = CurrentUser.Name;
        gu.Save();
        WebCommon.ShowMessageAndClose(this, "单位名称添加成功", "1");

    }
}
